package com.ruoyi.web.service.impl.strategy;

import com.ruoyi.web.abstracts.BaseStrategyService;
import com.ruoyi.web.domain.ArticleRequest;
import com.ruoyi.web.domain.dto.ArticleRequestDTO;
import com.ruoyi.web.enums.ArticleTypeEnum;
import com.ruoyi.web.mapper.ArticleRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: zhengxiong.jiang
 * @createDate: 2023/11/16
 * @version: 1.0
 */
@Service
public class VoteStrategyImpl extends BaseStrategyService {

    @Autowired
    private ArticleRequestMapper articleRequestMapper;

    @Override
    protected ArticleTypeEnum getType() {
        return ArticleTypeEnum.VOTE;
    }

    @Override
    public void doSomeThing(ArticleRequestDTO dto) {
        //进行投票文章逻辑处理
        ArticleRequest articleRequest = new ArticleRequest();
        articleRequest.setTitle(dto.getTitle());
        articleRequest.setContent("这是一条投票文章内容");
        articleRequest.setArticleType(dto.getArticleType().getValue());
        articleRequestMapper.insert(articleRequest);
    }

    @Override
    public void validate() {

    }
}
